import { ApiProperty } from '@nestjs/swagger';
import { PrimaryGeneratedColumn, Column, Entity } from 'typeorm';
import { BaseEntity } from '../base.entity';

@Entity({ name: 'sys_user' })
export default class SysUser extends BaseEntity {
  @PrimaryGeneratedColumn({comment: '用户ID' })
  @ApiProperty()
  id: number;

  @Column({ name: 'department_id',comment: '用户父ID',nullable: true})
  @ApiProperty()
  departmentId: number;

  @Column({comment: '用户自己的名字',nullable: true,})
  @ApiProperty()
  name: string;

  @Column({ unique: true,comment: '用户登录名称' })
  @ApiProperty()
  username: string;

  
  // @Column({ select: false})    // 表示隐藏此列
  @Column({comment: '用户密码'})
  @ApiProperty()
  password: string;

  @Column({ length: 32 ,nullable: true,comment: '盐'})
  @ApiProperty()
  psalt: string;

  @Column({ name: 'nick_name', nullable: true ,comment: '用户系统名称'})
  @ApiProperty()
  nickName: string;

  @Column({ name: 'head_img', nullable: true ,comment:"用户头像"})
  @ApiProperty()
  headImg: string;

  @Column({ nullable: true, default: '' ,comment:"用户邮箱"})
  @ApiProperty()
  email: string;

  @Column({ nullable: true, default: '' ,comment:"用户手机号"})
  @ApiProperty()
  phone: string;

  @Column({ nullable: true, default: '',comment: '备注' })
  @ApiProperty()
  remark: string;

  @Column({ type: 'tinyint', nullable: true, default: 1 ,comment: '用户的级别'})
  @ApiProperty()
  status: number;
}
